<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <a id="link" href="http://www.bing.com">BING1</a>
    <a onclick="event.preventDefault()" href="http://www.bing.com">BING2</a>
    <a onclick="return false;" href="http://www.bing.com">BING3</a>
    <script>
      const link = document.getElementById("link");
      link.onclick = function (e) {
        alert("hello");
        return false;
      };

      /* link.onclick = function (e) {
        e.preventDefault();
        alert("hello");
      }; */
    </script>
  </body>
</html>
